package fragments;

import android.content.Context;
import android.content.SharedPreferences;

import androidx.fragment.app.Fragment;

public abstract class BaseFragment extends Fragment {
    private final String KEY_SESSION_ID="sessionID";
    private final String KEY_USERNAME="username";

    private final String FILE="login";
    private final int MODE= Context.MODE_PRIVATE;

    private SharedPreferences sharedPreferences;
    protected Context context;

    public void onAttach(Context context){
        super.onAttach(context);
        this.context=context;
        sharedPreferences=context.getSharedPreferences(FILE,MODE);
    }

    protected  String getSessiconId(){
        return sharedPreferences.getString(KEY_SESSION_ID,"");
    }

    protected String getUserName(){
        return sharedPreferences.getString(KEY_USERNAME,"");
    }
}
